< previous page page_178 next page >

Page 178
· Is there a list of valid values for this field? (Can the user enter only Retail, Wholesale, or Other; Name must already be in the Customer table, and so on.)
· Is this a conditional field? (If users enter Yes in field A, then they must enter something in field C.)
You learned how to write keyboard filter validation functions using the Visual Basic 5 KeyPress event. You learned how to write field-level validation functions that check for valid input ranges, input that is part of a list of valid data, and input that is within minimum and maximum length requirements. You also learned how to write validation functions that make sure dependent fields have been filled out properly.
Finally, you learned how to use Visual Basic 5 to create your own custom control that incorporates all the validation techniques you learned in this chapter. You can use this ActiveX control in all your future Visual Basic projects.
You also applied your knowledge of bound data controls, Visual Basic 5 data entry form design, and validation processing to create the data entry form for the CompanyMaster data table.
Quiz
1. What is the difference between input validation and error trapping?
2. What value must you subtract from a lowercase character to get its uppercase ASCII value?
3. What Visual Basic 4 event occurs every time a key is pressed on your keyboard?
4. Do characters in a validation list need to be entered in any particular order?
5. What does the following code mean?
If Len(Trim(txtUpper)) <> 0 then
6. Should conditional field validation be performed at the field level or the form level?
7. When should you load validation lists?
8. What do the three sections of the format property of the MaskedEdit control represent? What character separates these sections?
Exercises
1. Write code to allow entry of only capital letters in a field. The user should be able to enter control codes, but not numbers or symbols.

 
< previous page page_178 next page >

If you like this book, buy it!